import re
import hashlib


def judge_phone(tel):
    """
    该函数判断一个字符串是否为手机号
    :param tel:
    :return:
    """
    tel = str(tel)
    ret = re.match(r'^(1[3|4|5|6|7|8|9])\d{9}$', tel)
    if ret:
        return True
    else:
        return False


def judge_email(email):
    """
    该函数判断一个字符串是否为邮箱号
    :param email:
    :return:
    """
    email = str(email)
    ret = re.findall('^\w+@\w+\.com$', email)
    if ret:
        return True
    else:
        return False


# md5加密函数
def password_encrypt(pwd):
    md5 = hashlib.md5()
    md5.update(pwd.encode())
    result = md5.hexdigest()
    return result
